-
-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RunContext enhancements #570
Conversation
can you update the commit message to be a bit more descriptive please? |
I also recommend removing |
Before this change, |
@blai This is still a new system, feel free to remove Also, could you send a follow-up PR to yeoman/yeoman.io updating the related documentation? |
I think I'd prefer the generator instance to be passed as an explicit parameter rather than it being linked to the |
@SBoudrias NP, I'll take care of it. |
@eddiemonge @SBoudrias Please comment |
it('accepts optional `cb` to be invoked with resolved `dir`', function (done) { | ||
var ctx = new RunContext(this.Dummy); | ||
var cb = sinon.spy(function () { | ||
assert(cb.calledOnce); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use sinon.assert
here:
sinon.assert.calledOnce(cb);
// etc
It output prettier (more useful) assertion reports :)
Ideally each feature should hold in it's own focused commit. But I understand if you don't want to edit your history. Also, can you keep the object literals on one line when they doesn't span more than 80-90 chars longs? |
@blai no twitter? |
… a chance to alter the environment to the a specific way and expect `env` and `generator` reflects such settings. - Emits `ready` event right before calling `generator.run()` to allow any last minute operation on the `generator` - Deprecating `onEnd`, instead emits 'end' event as `generator.on('end')` - Implement `withGenerator()` to mock generator dependencies - accepts optional second parameter in `inDir` as a callback function. fixes yeoman#564, yeoman#565, yeoman#573
@blai Cheers! |
this.env = yeoman(); | ||
|
||
this._dependencies.forEach(function (d) { | ||
if (d instanceof Array) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use _.isArray
?
@blai awesome works! I'm feeling pretty good about merging it. The only thing I'd like is for the |
…nerators into an env. (also change to use _.isArray for array type check)
…ould use it to perform async tasks. Rename `_onReady` to `_run` (since it is not really "ready" yet when it is called)
@SBoudrias adopting |
@blai oh right, clever 🎆 Merging! |
You'll update your PR on Yeoman.io for the doc? |
env
andgenerator
instatiation to_onReady
so user have a chance to alter the environment to the a specific way and expectenv
andgenerator
reflects such settings.ready
event right before callinggenerator.run()
to allow anylast minute operation on the
generator
onEnd
, instead emits 'end' event asgenerator.on('end')
withGenerators()
to mock generator dependenciesinDir
as a callback function._holdExec
toasync